package com.iflytek.hive.need8;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class MaxGoodsMapper extends Mapper<LongWritable, Text, GoodsAmountBean, NullWritable> {
    private final GoodsAmountBean keyOut = new GoodsAmountBean();
    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        // 将行文本数据切分
        String[] fields = value.toString().split(",");
        keyOut.set(fields[0],fields[1],Double.valueOf(fields[2]));
        context.write(keyOut, NullWritable.get());
    }

}
